package cn.techwis.vo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * 支付回调参数
 */
@NoArgsConstructor
@Data
@Builder
@AllArgsConstructor
public class PayNotifyVO {


    /**
     * 通知ID
     */
    @NotEmpty(message = "通知ID不能为空", groups = {PayNotify.class})
    private String id;
    /**
     * 通知创建时间
     */
    @NotEmpty(message = "通知创建时间不能为空", groups = {PayNotify.class})
    private String create_time;
    /**
     * 通知数据类型
     */
    @NotEmpty(message = "通知数据类型不能为空 ", groups = {PayNotify.class})
    private String resource_type;
    /**
     * 通知类型
     */
    @NotEmpty(message = "通知类型不能为空 ", groups = {PayNotify.class})
    private String event_type;
    /**
     * 通知数据
     */
    @NotNull(message = "通知数据不能为空", groups = {PayNotify.class})
    @Valid
    private ResourceVO resource;
    /**
     * 回调摘要
     */
    @NotEmpty(message = "回调摘要不能为空", groups = {PayNotify.class})
    private String summary;

    @NoArgsConstructor
    @Data
    @Builder
    @AllArgsConstructor
    public static class ResourceVO {


        /**
         * 加密算法类型
         */
        @NotEmpty(message = "加密算法类型不能为空", groups = {PayNotify.class})
        private String algorithm;

        /**
         * 数据密文
         */
        @NotEmpty(message = "数据密文不能为空", groups = {PayNotify.class})
        private String ciphertext;

        /**
         * 随机串
         */
        @NotEmpty(message = "随机串不能为空", groups = {PayNotify.class})
        private String nonce;

        /**
         * 原始类型
         */
        @NotEmpty(message = "原始类型不能为空", groups = {PayNotify.class})
        private String original_type;

        /**
         * 附加数据
         */
        @NotEmpty(message = "附加数据不能为空", groups = {PayNotify.class})
        private String associated_data;
    }

    public @interface PayNotify {
    }
}
